package com.lcz.googleplay.utils;

import android.content.Context;
import android.content.res.Resources;

import com.lcz.googleplay.R;
import com.lcz.googleplay.activity.BaseApplication;

/**
 * Created by hp on 2016/10/25.
 */

public class UIUtils {
    /*返回条目数组*/
    public static String[] getTab_name() {
        return getResources().getStringArray(R.array.tab_name);
    }

    /*获取上下文对象*/
    private static Resources getResources() {
        return BaseApplication.getApplication().getResources();
    }

    public static Context getActivity() {
        return BaseApplication.getApplication();
    }

    public static void runOnUiThread(Runnable runnable) {
        //判断是否在主线程中运行
        if (android.os.Process.myTid() == BaseApplication.getMainTid()) {
            runnable.run();
        } else {//子线程运行的话，就交给handler处理
            BaseApplication.getHandler().post(runnable);
        }
    }
}
